package com.aztec.ims.service.dao;

import java.util.List;

import com.aztec.ims.domain.PaymentTerms;
import com.aztec.ims.service.response.GenericResponse;

public class TestPaymentTermsDao {
	public static void main(String[] args) {

		save();
		get();
	}

	private static void save() {
		PaymentTermsDao dao = new PaymentTermsDao();

		PaymentTerms request = new PaymentTerms();
		request.setPymtName("cash payment");
		request.setDueDays(Integer.valueOf(10));
		request.setActiveFlag(Boolean.TRUE);
		GenericResponse response = dao.createPaymentTerms(request);
		System.out.println("*****Tax scheme id generated:" + response.getId()
				+ "******");
	}

	private static void get() {
		PaymentTermsDao dao = new PaymentTermsDao();
		List list = dao.getPaymentTerms();
		for (int i = 0; i < list.size(); i++) {
			PaymentTerms info = (PaymentTerms) list.get(i);
			System.out.println("***" + i + ": " + info.getPymtId()
					+ " **name: " + info.getPymtName() + " ** duedays:"
					+ info.getDueDays() + " ** active" + info.getActiveFlag());
		}
	}

}
